package com.zyf.springboot.controller;

import com.zyf.springboot.entity.LoginUser;
import com.zyf.springboot.entity.Result;
import com.zyf.springboot.mapper.UserMapper;
import org.apache.shiro.authz.annotation.RequiresRoles;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import java.util.ArrayList;
import java.util.List;

@RestController
public class TestController {
    @Resource
    UserMapper userMapper;
    @GetMapping("/test")
    public Object test(){
        return userMapper.selectList(null);
    }
    @GetMapping("/test1")
    public Object test1(){
        return userMapper.selectList(null);
    }
    @PostMapping("/test2")
    public Result<LoginUser> test2(){
        LoginUser loginUser = new LoginUser("zs", "123");
        Result<LoginUser> result=new Result<>();
        result.setCode(0);
        result.setCount(1000);
        List<LoginUser> list=new ArrayList<>();
        list.add(loginUser);
        result.setData(list);
        return result;
    }
}
